'use strict';

const webpack = require('webpack');
const configuration = require('./app/server/commons/factories/configuration');
const serverCfg = configuration.get('server');

module.exports = {
    watch: true,
    output: {
        filename: '[name].js',
        chunkFilename: '[id].chunk.js'
    },
    resolve: {
        modulesDirectories: ['node_modules', 'public/components'],
        alias: {
            'js': serverCfg.CLIENT_DIR + '/js',
            'tpls': serverCfg.CLIENT_DIR + '/tpls'
        }
    },
    module: {
        loaders: [],
        noParse: []
    },
    devtool: 'eval',
    plugins: [
        new webpack.ProvidePlugin({
            jQuery: 'jquery'
        }),
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false
            }
        }),
        new webpack.ResolverPlugin([
            new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])
        ], ['normal', 'loader'])
    ]
};